import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'
import Login from './views/Login.vue'
import AddEvent from './components/event/AddEvent.vue'
import Event from './components/event/Event.vue'
import EventDetail from './components/event/EventDetail.vue'
import EventDetail3 from './components/event/EventDetail3.vue'
import EventDetails from './components/event/EventDetails.vue'
import ConfireHandler from './components/event/ConfireHandler.vue'
import Reject from './components/event/Reject.vue'
import transferOrder from './components/event/TransferOrder.vue'
import store from './store/index'
import Pwd from './components/changePwd'
import Page from './components/page.vue'
import Task from './components/tark/Task'
import TaskDetail from './components/tark/TaskDetail'
Vue.use(Router)

const router = new Router({
        routes: [{
            path: '/',
            redirect: '/login'
        }, {
            path: '/home',
            name: 'home',
            component: Home
        }, {
            path: '/addevent',
            name: 'addevent',
            component: AddEvent
        }, {
            path: '/login',
            name: 'login',
            component: Login
        }, {
            path: '/event',
            name: 'event',
            component: Event
        }, {
            path: '/EventDetail/:id',
            name: 'eventdetail',
            component: EventDetail
        }, {
            path: '/EventDetails/:id',
            name: 'eventdetails',
            component: EventDetails
        }, {
            path: '/EventDetail3/:id',
            name: 'eventdetail3',
            component: EventDetail3
        }, {
            path: '/ConfireHandler/:id',
            name: 'confirehandler',
            component: ConfireHandler
        }, {
            path: '/reject/:id',
            name: 'reject',
            component: Reject
        }, {
            path: '/transferOrder/:id/:districtId',
            name: 'transferOrder',
            component: transferOrder
        }, {
            path: '/page',
            name: 'page',
            component: Page
        }, {
            path: '/task',
            name: 'task',
            component: Task
        }, {
            path: '/TaskDetail/:id',
            name: 'taskdetail',
            component: TaskDetail
        }, {
            path: '/pwd',
            name: 'pwd',
            component: Pwd
        }]
    })
    // router.beforeEach((to, form, next) => {
    // if ('/login' == to.path) {
    //     store.commit("set_isShowBar", false);
    // } else {
    //     store.commit("set_isShowBar", true);
    // }
    // if (null == sessionStorage.getItem('set_token')) {
    //     if (to.path !== '/login') {
    //         return next('/login')
    //     }
    // }
    // next();
    // })
export default router